﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Aphysoft.Vate.Editor;
using Microsoft.Xna.Framework;
using Aphysoft.Vate.Graphics;

namespace Aphysoft.Vate.Studio
{
    public partial class FormMain : VateEditor
    {
        public FormMain() : base()
        {
            InitializeComponent();

            RenderPanel = panelRender;            
        }

        private Camera dc;

        protected override void EditorInitialize()
        {
            dc = new Camera("test");
            ProjectorManager.DefaultProjector.Camera = dc;
        }

        protected override void EditorLoadContent()
        {
        }

        protected override void EditorUnloadContent()
        {
        }

        protected override void EditorUpdate(GameTime gameTime)
        {
        }

        protected override void EditorDraw(GameTime gameTime)
        {
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            Start();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }


        private void FormMain_ResizeEnd(object sender, EventArgs e)
        {
            EditorReset();
        }

        FormWindowState previousWindowState = FormWindowState.Normal;

        private void FormMain_SizeChanged(object sender, EventArgs e)
        {
            if (WindowState == FormWindowState.Maximized)
            {
                EditorReset();
                previousWindowState = FormWindowState.Maximized;
            }
            else if (WindowState == FormWindowState.Normal)
            {
                if (previousWindowState == FormWindowState.Maximized)
                {
                    EditorReset();
                    previousWindowState = FormWindowState.Normal;
                }
            }
        }

        private void splitterLeft_SplitterMoved(object sender, SplitterEventArgs e)
        {
            EditorReset();
        }
    }
}
